const enterpriseVue = new Vue({
  el: '#app',
  data() {
    return {
      rules: {
        Column_Name: [{
          required: true,
          message: '请输入栏目名称',
          trigger: 'blur',
        }],
        App_ID: [{
          required: true,
          message: '请输入小程序APP_ID',
          trigger: 'blur',
        }],
      },
      dialogImageUrl: '',
      dialogVisible: false,
      form: {
        // App_ID: 'wx301fac0c9c978e88',
        App_ID: 'wx752cd7c5466abbaf',    //小程序appid
        Column_Name: '',
        Enterprise_Info_SerialNumber: $.cookie("enterprise"),
        Activity: "0"
      },
      loading: false
    }
  },
  mounted() {

  },
  methods: {
    submitForm(formName) {
      let _this = this
      console.log(this.form);
      this.$refs[formName].validate((valid) => {
        if (valid) {
          _this.loading = true
          $.ajax({
            url: DomainName + '/getAddAction',
            type: 'POST',
            data: {
              Data: JSON.stringify({ column_main: [_this.form] }),
              token: $.cookie("token")
            },
            success: function (res) {
              console.log('提交结果', res)
              _this.$message.success("提交成功")
              window.location.href = './Column.html'
            },
            error: function () {
              _this.$message.error("操作失败，请稍后再试")
            },
            complete: function (XMLHttpRequest) {
              _this.loading = false
              if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
                window.parent.document.location.href = "../../../../" + XMLHttpRequest.getResponseHeader("CONTENTPATH");
              }
            }
          })
        } else {
          console.log("error submit!!");
          return false;
        }

      });
    },
    resetForm(formName) {
      this.$refs[formName].resetFields();
    }
  }
})